﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="UpdateMusic.aspx.vb" Inherits="UpdateMusic" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="CSS/Settings.css" rel="stylesheet" type="text/css" />
    <script src="Javascript/jquery.js" type="text/javascript"></script>
    <title></title>
</head>

<body bgcolor="#0b5eba">
    <form id="form1" runat="server">

    <asp:HiddenField ID="fldHidden" runat="server" />

    <asp:ScriptManager ID="scriptManager" runat="server" EnablePageMethods="true" />

    <h1>Actualizando lista de música</h1>
    <h2>El proceso de actualización puede tardar varios minutos.</h2>
    
    <div class="titulos">
        <p>Carpeta:</p>
        <p>Artistas:</p>
        <p>Discos:</p>
        <p>Canciones:</p>
        <p>Géneros:</p>
    </div>

    <div class="valores">
        <p id="lblFolder">&nbsp</p>
        <p id="lblArtistsQty">0</p>
        <p id="lblAlbumsQty">0</p>
        <p id="lblSongsQty">0</p>
        <p id="lblTagsQty">0</p>
    </div>

    <asp:Panel ID="pnlProcessCompleted" runat="server"
        CssClass="modalPopup"
        Style="display:none">
        <div class="modalTitle">Proceso completo</div>
        <div class="modalContent">
            La lista de música está actualizada.
        </div>
        <div class="modalButtons">
            <asp:Button ID="btnOk" runat="server" Text="Ok" OnClientClick="javascript:window.location = 'Start.aspx';return false;" />
        </div>
    </asp:Panel>

    <ajaxToolkit:ModalPopupExtender ID="mpeProcessCompleted" runat="server"
        TargetControlID = "fldHidden"
        PopupControlID = "pnlProcessCompleted" 
        OkControlID="btnOk" 
        BackgroundCssClass="modalBackground" />

    <script language="javascript" type="text/javascript" >

        $(document).ready(function() {
            setTimeout("get_processingStatus()", 1000);
        });

        function get_processingStatus() {
            PageMethods.GetProcessingStatus(update_processingStatus);
        }

        function update_processingStatus(processingStatus) {
            $('#lblFolder').text(processingStatus[5]);
            $('#lblAlbumsQty').text(processingStatus[0]);
            $('#lblArtistsQty').text(processingStatus[1]);
            $('#lblSongsQty').text(processingStatus[2]);
            $('#lblTagsQty').text(processingStatus[3]);
            if (processingStatus[4] == 'False') {
                $find('mpeProcessCompleted').show();                
            }
            else {
                setTimeout("get_processingStatus()", 1000);
            }
        }    
    
    </script>
    
    </form>
</body>

</html>
